package cn.itcast.redis;

import java.util.HashSet;
import java.util.Set;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

public class ClusterJedisDemo {
    public static void main(String[] args) {
        Set<HostAndPort> nodes = new HashSet<HostAndPort>();
        nodes.add(new HostAndPort("192.168.56.101", 6380));
        nodes.add(new HostAndPort("192.168.56.101", 6381));
        nodes.add(new HostAndPort("192.168.56.101", 6382));
        JedisCluster jedisCluster = new JedisCluster(nodes);
        
        jedisCluster.set("num", "123");
        
        System.out.println(jedisCluster.get("num"));
        
        jedisCluster.close();
    }
}
